﻿<navigation:Page x:Class="PmuRegistry.Silverlight.Pages.Devices.Browse" 
           xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
           xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"  
           xmlns:converter="clr-namespace:PmuRegistry.Silverlight.Converters" 
           xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data"
           xmlns:DefaultButton="clr-namespace:PmuRegistry.Silverlight.Utilities" 
           Title="NASPI PMU Registry: Browse Devices">
    <Grid x:Name="GridBrowseDevices">
        <Border Style="{StaticResource PortletBorderStyle}">
            <StackPanel Orientation="Vertical">
                <StackPanel.Resources>
                    <converter:StringToDictionaryConverter x:Key="stringToDictionaryConverter" />
                </StackPanel.Resources>
                <TextBlock Text="Browse Devices" Foreground="#FFFFFFFF" HorizontalAlignment="Center" FontSize="{StaticResource LargerTextSize}" Padding="5" />
                <Border Style="{StaticResource HeaderRowBorderStyle}">
                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" VerticalAlignment="Center">
                        <TextBox x:Name="TextBoxSearch" Width="{StaticResource SmallItemSize}" Height="{StaticResource XXXSmallItemSize}" Margin="5" DefaultButton:DefaultButtonService.DefaultButton="{Binding ElementName=ButtonSearch}" />
                        <Button x:Name="ButtonSearch" Content="../../Images/Search.png" Tag="Search" Template="{StaticResource ImageButtonTemplate}" VerticalAlignment="Center" Margin="5" Cursor="Hand">
                            <Button.RenderTransform>
                                <ScaleTransform x:Name="ButtonSearchTransform" ScaleX="1" ScaleY="1" />
                            </Button.RenderTransform>                            
                        </Button>
                        <Button x:Name="ButtonShowAll" Content="../../Images/CancelSearch.png" Tag="Show All" Template="{StaticResource ImageButtonTemplate}" VerticalAlignment="Center" Margin="5" Cursor="Hand">
                            <Button.RenderTransform>
                                <ScaleTransform x:Name="ButtonShowAllTransform" ScaleX="1" ScaleY="1" />
                            </Button.RenderTransform>
                        </Button>
                    </StackPanel>
                </Border>
                <Border Style="{StaticResource HeaderRowBorderStyle}">
                    <StackPanel Orientation="Horizontal" Margin="2">
                        <Border Style="{StaticResource HeaderRowCellBorderStyle}">
                            <TextBlock Text="Acronym" Width="{StaticResource SmallerItemSize}" TextAlignment="Center" FontSize="{StaticResource LargeTextSize}" FontWeight="Bold"/>
                        </Border>                                                                        
                        <Border Style="{StaticResource HeaderRowCellBorderStyle}">
                            <TextBlock Text="Company" Width="{StaticResource XSmallItemSize}" TextAlignment="Center" FontSize="{StaticResource LargeTextSize}" FontWeight="Bold"/>
                        </Border>
                        <Border Style="{StaticResource HeaderRowCellBorderStyle}">
                            <TextBlock Text="Vendor Device" Width="{StaticResource LargeItemSize}" TextAlignment="Center" FontSize="{StaticResource LargeTextSize}" FontWeight="Bold"/>
                        </Border>
                        <Border Style="{StaticResource HeaderRowCellBorderStyle}">
                            <TextBlock Text="Concentrator" Width="{StaticResource SmallerItemSize}" TextAlignment="Center" FontSize="{StaticResource LargeTextSize}" FontWeight="Bold"/>
                        </Border>
                        <Border Style="{StaticResource HeaderRowCellBorderStyle}">
                            <TextBlock Text="Status" Width="{StaticResource LargeItemSize}" TextAlignment="Center" FontSize="{StaticResource LargeTextSize}" FontWeight="Bold"/>                            
                        </Border>
                        <Border Style="{StaticResource HeaderRowCellBorderStyle}">
                            <TextBlock Text="Phasors" Width="{StaticResource SmallerItemSize}" TextAlignment="Center" FontSize="{StaticResource LargeTextSize}" FontWeight="Bold"/>                            
                        </Border>
                        <TextBlock Text="Measurements" Width="{StaticResource SmallItemSize}" TextAlignment="Center" FontSize="{StaticResource LargeTextSize}" FontWeight="Bold"/>                        
                    </StackPanel>
                </Border>
                <Border Background="{StaticResource PortletBackgroundBrush}">
                    <ScrollViewer HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto" BorderThickness="0" Height="558">
                        <ScrollViewer.Content>
                            <ListBox x:Name="ListBoxDeviceList" Margin="0" Padding="0">
                                <ListBox.ItemTemplate>
                                    <DataTemplate>
                                        <StackPanel Orientation="Horizontal">
                                            <Border Style="{StaticResource ContentRowCellBorderStyle}">
                                                <HyperlinkButton Content="{Binding Path=Acronym}" Tag="{Binding Path=ID}" Foreground="#FF095188" Width="{StaticResource SmallerItemSize}" Click="HyperlinkButton_Click" Cursor="Hand"/>
                                            </Border>                                            
                                            <Border Style="{StaticResource ContentRowCellBorderStyle}">
                                                <TextBlock Text="{Binding Path=CompanyAcronym}" Width="{StaticResource XSmallItemSize}" TextAlignment="Left" Padding="0"/>
                                            </Border>
                                            <Border Style="{StaticResource ContentRowCellBorderStyle}">
                                                <TextBlock Text="{Binding Path=VendorDeviceName}" Width="{StaticResource LargeItemSize}" TextAlignment="Left" Padding="0"/>
                                            </Border>
                                            <Border Style="{StaticResource ContentRowCellBorderStyle}" Width="{StaticResource SmallerItemSize}">
                                                <CheckBox HorizontalAlignment="Center" IsChecked="{Binding Path=IsConcentrator}" IsEnabled="False" />
                                            </Border>
                                            <Border Style="{StaticResource ContentRowCellBorderStyle}">
                                                <StackPanel Orientation="Horizontal" Width="{StaticResource LargeItemSize}" VerticalAlignment="Center">
                                                    <ComboBox x:Name="ComboboxStatus" DisplayMemberPath="Value" SelectedItem="{Binding Path=StatusID, Mode=TwoWay, Converter={StaticResource stringToDictionaryConverter}}" Width="{StaticResource SmallItemSize}" Loaded="ComboboxStatus_Loaded" Height="20" VerticalAlignment="Center" SelectionChanged="ComboboxStatus_SelectionChanged" />                                                    
                                                    <Button Content="../../Images/Save.png" Tag="" Template="{StaticResource ImageButtonTemplate}" Margin="5,0,0,0" Cursor="Hand" Click="ButtonSave_Click" />
                                                </StackPanel>
                                            </Border>
                                            <Border Style="{StaticResource ContentRowCellBorderStyle}">
                                                <HyperlinkButton Content="Phasors" HorizontalContentAlignment="Center" Name="{Binding Path=Acronym}" Tag="{Binding Path=ID}" Foreground="#FF095188" Width="{StaticResource SmallerItemSize}" Click="HyperlinkButtonPhasors_Click" Cursor="Hand">                                                    
                                                </HyperlinkButton>
                                            </Border>
                                            <Border Style="{StaticResource ContentRowCellBorderStyle}">
                                                <HyperlinkButton Content="Measurements" HorizontalContentAlignment="Center" Name="{Binding Path=Acronym}" Tag="{Binding Path=ID}" Foreground="#FF095188" Width="{StaticResource SmallItemSize}" Click="HyperlinkButtonMeasurements_Click" Cursor="Hand">                                                    
                                                </HyperlinkButton> 
                                            </Border>                                            
                                        </StackPanel>
                                    </DataTemplate>
                                </ListBox.ItemTemplate>
                            </ListBox>
                        </ScrollViewer.Content>
                    </ScrollViewer>
                </Border>
                <data:DataPager x:Name="DataPagerDevices" PageSize="19" AutoEllipsis="True" NumericButtonCount="3" DisplayMode="FirstLastPreviousNext"/>
            </StackPanel>
        </Border>
    </Grid>
</navigation:Page>
